<template>
	<view>
		订单确认
		<button @tap="confirmPay">确认付款</button>
		<!-- 选择省市区 -->
		<button @tap="chooseAddress">选择省市区</button>
		<simple-address 
		ref="simpleAddress" 
		:pickerValueDefault="cityPickerValueDefault" 
		@onConfirm="onConfirm"
			themeColor="#007AFF">
		</simple-address>
	</view>
</template>

<script>
	import {
		getPreOrderById as getPreOrderByIdApi
	} from '@/api/confirmOrder/index.js'

	import simpleAddress from '@/components/simple-address/simple-address.vue';
	export default {
		name: "ConfirmOrder",
		data() {
			return {
				orderId: '',
				cityPickerValueDefault: [0, 0, 1],
			};
		},
		components: {
			simpleAddress
		},
		onLoad(options) {
			this.orderId = options.orderid
			this.getPreOrderById()
		},
		methods: {
			async getPreOrderById() {
				const res = await getPreOrderByIdApi(this.orderId)
			},
			confirmPay() {
				// if(没有收货地址) return
				// 发请求
			},
			onConfirm(e) {
				console.log(e);
			},
			chooseAddress(){
				 this.$refs.simpleAddress.open();
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
